<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>D3 选择器</title>
    <script src="https://cdn.bootcss.com/d3/5.15.1/d3.js"></script>
    <style>
        div {
            height: 100px;
            width: 100px;
            background-color: #eee;
            margin: 10px;
        }

    </style>
</head>

<body>
    <div></div>
    <div id="box" class="col-md" title="这是title的值"></div>
    <div></div>
    <script>
        // let divs = document.getElementsByTagName("div");
        // console.log(divs)
        // console.log(d3.selectAll("div"))
        // console.log(d3.select("#box"))
        function p(obj) {
            console.log(obj)
        }
        d3.selectAll("div").attr("title", "这是改变后的title值").style("background-color", "#999");
        p(d3.selectAll("div").nodes())

    </script>
</body>

</html>
